<!DOCTYPE html>



  


<html class="theme-next gemini use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/limh/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/limh/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/limh/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/limh/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/limh/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/limh/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/limh/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="教程,">










<meta name="description" content="下面是一个简单的屏幕编辑的C语言程序，它不仅涉及到键盘处理、光标定位、屏幕输出、字符颜色等，而且还运用了C语言和汇编语言的混合编程方法。若读者能把它改写成相同功能的汇编语言程序，那么，可以说，你已基本掌握了中断的使用方法，也对计算机输入输出的工作方式有了更进一步的认识。 该程序的功能：  可用移动光标键↑、↓、←和→移动光标1行或1列，也可用TAB/Shift+TAB、Home和End键跳跃地移动">
<meta name="keywords" content="教程">
<meta property="og:type" content="article">
<meta property="og:title" content="12.3 简单的屏幕编辑程序">
<meta property="og:url" content="https://tdnr.gitee.io/limh/2015/04/01/asm57/index.html">
<meta property="og:site_name" content="土逗牛肉">
<meta property="og:description" content="下面是一个简单的屏幕编辑的C语言程序，它不仅涉及到键盘处理、光标定位、屏幕输出、字符颜色等，而且还运用了C语言和汇编语言的混合编程方法。若读者能把它改写成相同功能的汇编语言程序，那么，可以说，你已基本掌握了中断的使用方法，也对计算机输入输出的工作方式有了更进一步的认识。 该程序的功能：  可用移动光标键↑、↓、←和→移动光标1行或1列，也可用TAB/Shift+TAB、Home和End键跳跃地移动">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-01-23T03:27:45.741Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="12.3 简单的屏幕编辑程序">
<meta name="twitter:description" content="下面是一个简单的屏幕编辑的C语言程序，它不仅涉及到键盘处理、光标定位、屏幕输出、字符颜色等，而且还运用了C语言和汇编语言的混合编程方法。若读者能把它改写成相同功能的汇编语言程序，那么，可以说，你已基本掌握了中断的使用方法，也对计算机输入输出的工作方式有了更进一步的认识。 该程序的功能：  可用移动光标键↑、↓、←和→移动光标1行或1列，也可用TAB/Shift+TAB、Home和End键跳跃地移动">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/limh/',
    scheme: 'Gemini',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://tdnr.gitee.io/limh/2015/04/01/asm57/">





  <title>12.3 简单的屏幕编辑程序 | 土逗牛肉</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans ">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/limh/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">土逗牛肉</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/limh/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/limh/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/limh/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/limh/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/limh/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br>
            
            关于
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://tdnr.gitee.io/limh/limh/2015/04/01/asm57/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="土逗牛肉">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/limh/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="土逗牛肉">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">12.3 简单的屏幕编辑程序</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2015-04-01T20:36:21+08:00">
                2015-04-01
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/limh/categories/汇编教程/" itemprop="url" rel="index">
                    <span itemprop="name">汇编教程</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>下面是一个简单的屏幕编辑的C语言程序，它不仅涉及到键盘处理、光标定位、屏幕输出、字符颜色等，而且还运用了C语言和汇编语言的混合编程方法。若读者能把它改写成相同功能的汇编语言程序，那么，可以说，你已基本掌握了中断的使用方法，也对计算机输入输出的工作方式有了更进一步的认识。</p>
<p>该程序的功能：</p>
<ul>
<li>可用移动光标键↑、↓、←和→移动光标1行或1列，也可用TAB/Shift+TAB、Home和End键跳跃地移动光标；</li>
<li>当光标已在第1行，再向上移动时，这时，光标被定位到第25行，反之也然；</li>
<li>当光标已在第0列，还要向左移动时，光标被定位到第79列，反之也然；</li>
<li>当按下^W或^Z时，屏幕将向上或向下滚动1行；</li>
<li>显示当前键盘的状态：大小写状态、数字键盘状态和插入/修改状态；</li>
<li>如果按普通的键，将在屏幕上显示该字符，如果按下用Alt、Ctrl或Shift组合的组合键，则显示该按键的扫描码；</li>
<li>用Esc键来结束程序的运行。</li>
</ul>
<p>C语言的源程序清单：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br></pre></td><td class="code"><pre><span class="line">#define　NUM_KEY　0x20　/*　键盘状态字宏定义　*/</span><br><span class="line"></span><br><span class="line">#define　CAPS_KEY　0x40</span><br><span class="line"></span><br><span class="line">#define　ESCAPE　27　/*　几个功能键的宏定义　*/</span><br><span class="line"></span><br><span class="line">#define　TAB_KEY　9</span><br><span class="line"></span><br><span class="line">#define　SHIFT_TAB　15</span><br><span class="line"></span><br><span class="line">#define　CTRL_W　23</span><br><span class="line"></span><br><span class="line">#define　CTRL_Z　26</span><br><span class="line"></span><br><span class="line">#define　UP_ARROW　72</span><br><span class="line"></span><br><span class="line">#define　DOWN_ARROW　80</span><br><span class="line"></span><br><span class="line">#define　LEFT_ARROW　75</span><br><span class="line"></span><br><span class="line">#define　RIGHT_ARROW　77</span><br><span class="line"></span><br><span class="line">#define　INSERT　82</span><br><span class="line"></span><br><span class="line">#define　END_KEY　79</span><br><span class="line"></span><br><span class="line">#define　HOME_KEY　71</span><br><span class="line"></span><br><span class="line">#define　UP_SCROLL　6　/*　屏幕滚动宏定义　*/</span><br><span class="line"></span><br><span class="line">#define　DOWN_SCROLL　7 </span><br><span class="line"></span><br><span class="line">#include </span><br><span class="line"></span><br><span class="line">              int       insert, cap_key, num_key            ;</span><br><span class="line"></span><br><span class="line">/* up_down：屏幕滚动方式：6-向上滚; 7-向下滚</span><br><span class="line"></span><br><span class="line">(l_row, l_col)-(r_row, r_col)：滚动矩形的对角线坐标</span><br><span class="line"></span><br><span class="line">num：屏幕滚动的行数，0-清屏</span><br><span class="line"></span><br><span class="line">attr：滚动后所剩下行的属性　*/</span><br><span class="line"></span><br><span class="line">cls(int up_down, int l_row, int l_col, int r_row, int r_col, int num, int attr) </span><br><span class="line"></span><br><span class="line">get_cursor(int *x, int *y)　/* 取当前光标的位置，并分别存入变量x和y中 */ </span><br><span class="line"></span><br><span class="line">locate(int row, int col)　/* 把光标设置在(row, col)位置 */ </span><br><span class="line"></span><br><span class="line">disp_string(int row, int col, char string[])　/* 在(row, col)位置显示字符串string */ </span><br><span class="line"></span><br><span class="line">check_key_state()　/* 在(row, col)位置以属性attr显示字符ch */ </span><br><span class="line"></span><br><span class="line">insert_key()　/* 在最后一行显示插入/修改状态标志，并改变光标形状 */ </span><br><span class="line"></span><br><span class="line">move_right(int row, int col, int len)　/* 在(row, col)位置之后的字符和属性向后移len个位置 */ </span><br><span class="line"></span><br><span class="line">read_char_attr(int row, int col, char *ch, int *attr)　/* 在读(row, col)位置字符和属性，并分别存入ch和attr */ </span><br><span class="line"></span><br><span class="line">write_char_attr(int row, int col, char ch, int attr)　/* 在(row, col)位置以属性attr显示字符ch */ </span><br><span class="line"></span><br><span class="line">ctos(char ascii, char str[])　/* 把字符的ASCII码转换成字符串 */ </span><br><span class="line"></span><br><span class="line">main()</span><br><span class="line"></span><br><span class="line">&#123;int k, key, row, col;</span><br><span class="line"></span><br><span class="line">char ch1, ch2, str[]=&quot; $&quot;;　/*　前面有3个空格　*/</span><br><span class="line"></span><br><span class="line">char msg1[]=&quot;This is a simple screen edidtor.$&quot;,</span><br><span class="line"></span><br><span class="line">msg2[]=&quot;You can move cursor by Arrow keys, TAB/Shift-TAB, Home and End.$&quot;,</span><br><span class="line"></span><br><span class="line">msg3[]=&quot;You can press ^W for scroll up or ^Z for scroll down.$&quot;,</span><br><span class="line"></span><br><span class="line">msg4[]=&quot;It has some functions, such as insert/modify a char.$&quot;,</span><br><span class="line"></span><br><span class="line">msg5[]=&quot;If you press a function key, or key combined with Alt, Ctrl, Shift, it will display the key&apos;s scan code.$&quot;,</span><br><span class="line"></span><br><span class="line">msg6[]=&quot;The program exits when you press ESCAPE.$&quot;; </span><br><span class="line"></span><br><span class="line">cls(UP_SCROLL, 0, 0, 24, 79, 0, 7);</span><br><span class="line"></span><br><span class="line">disp_string(0, 0, msg1); disp_string(2, 0, msg2);</span><br><span class="line"></span><br><span class="line">disp_string(4, 0, msg3); disp_string(6, 0, msg4);</span><br><span class="line"></span><br><span class="line">disp_string(8, 0, msg5); disp_string(11, 0, msg6);</span><br><span class="line"></span><br><span class="line">         row  =         col = ch1 = insert = 0  ;</span><br><span class="line"></span><br><span class="line">locate(row, col); </span><br><span class="line"></span><br><span class="line">while (ch1 != ESCAPE)</span><br><span class="line"></span><br><span class="line">&#123;while (ch1 != ESCAPE)</span><br><span class="line"></span><br><span class="line">&#123;if (!bioskey(1)) &#123;check_key_state(); continue;&#125;</span><br><span class="line"></span><br><span class="line">         key  =         bioskey(0)  ;</span><br><span class="line"></span><br><span class="line">         ch1  =         key         ; ch2 = key &gt;&gt; 8;</span><br><span class="line"></span><br><span class="line">              if        (ch1 != 0)</span><br><span class="line"></span><br><span class="line">&#123;switch(ch1)</span><br><span class="line"></span><br><span class="line">&#123;case TAB_KEY:</span><br><span class="line"></span><br><span class="line">         col  =         ((col&amp;0xFFF8) + 8) %80  ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case CTRL_W:</span><br><span class="line"></span><br><span class="line">cls(DOWN_SCROLL, 0, 0, 24, 79, 1, 7);</span><br><span class="line"></span><br><span class="line">         row  =         row + 1     ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case CTRL_Z:</span><br><span class="line"></span><br><span class="line">cls(UP_SCROLL, 0, 0, 24, 79, 1, 7);</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">    default:</span><br><span class="line"></span><br><span class="line">              if        (ch1 == ESCAPE) continue            ;</span><br><span class="line"></span><br><span class="line">              if        (insert) move_right(row, col, 1)    ;</span><br><span class="line"></span><br><span class="line">write_char_attr(row, col, ch1, 31);</span><br><span class="line"></span><br><span class="line">         col  =         (col+1+80) % 80         ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">locate(row, col);</span><br><span class="line"></span><br><span class="line">continue;</span><br><span class="line"></span><br><span class="line">&#125; </span><br><span class="line"></span><br><span class="line">switch (ch2)</span><br><span class="line"></span><br><span class="line">&#123;case UP_ARROW:</span><br><span class="line"></span><br><span class="line">         row  =         (row-1+25) % 25         ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case DOWN_ARROW:</span><br><span class="line"></span><br><span class="line">         row  =         (row+1+25) % 25         ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case LEFT_ARROW:</span><br><span class="line"></span><br><span class="line">         col  =         (col-1+80) % 80         ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case RIGHT_ARROW:</span><br><span class="line"></span><br><span class="line">         col  =         (col+1+80) % 80         ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case SHIFT_TAB:</span><br><span class="line"></span><br><span class="line">           k  =         col &amp; 0xFFF8            ;</span><br><span class="line"></span><br><span class="line">         col  =         (col - ((k==0)? 8:k+80)) % 80       ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case HOME_KEY:</span><br><span class="line"></span><br><span class="line">         col  =         0           ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case END_KEY:</span><br><span class="line"></span><br><span class="line">         col  =         79          ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">case INSERT:</span><br><span class="line"></span><br><span class="line">              insert_key(&amp;insert)                   ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">    default:</span><br><span class="line"></span><br><span class="line">ctos(ch2, str);</span><br><span class="line"></span><br><span class="line">           k  =         strlen(str)-1           ;</span><br><span class="line"></span><br><span class="line">              if        (insert) move_right(row, col, k)    ;</span><br><span class="line"></span><br><span class="line">disp_string(row, col, str);</span><br><span class="line"></span><br><span class="line">         col  =         (col + k + 80) % 80     ;</span><br><span class="line"></span><br><span class="line">break;</span><br><span class="line"></span><br><span class="line">&#125; </span><br><span class="line"></span><br><span class="line">locate(row, col);</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">cls(UP_SCROLL, 0, 0, 24, 79, 0, 7);</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/limh/tags/教程/" rel="tag"># 教程</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/limh/2015/04/01/asm56/" rel="next" title="12.2 C语言程序的汇编输出">
                <i class="fa fa-chevron-left"></i> 12.2 C语言程序的汇编输出
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/limh/2015/04/01/asm58/" rel="prev" title="1.1 宏汇编MASM系统">
                1.1 宏汇编MASM系统 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="SOHUCS"></div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      

      <section class="site-overview-wrap sidebar-panel sidebar-panel-active">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/limh/images/avatar.jpg" alt="土逗牛肉">
            
              <p class="site-author-name" itemprop="name">土逗牛肉</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/limh/archives/">
              
                  <span class="site-state-item-count">255</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/limh/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/limh/tags/index.html">
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/limhGeek" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:1591054297@qq.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://www.jianshu.com/u/f73b243e7cc9" target="_blank" title="简书">
                      
                        <i class="fa fa-fw fa-user-circle-o"></i>简书</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">土逗牛肉</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
	var str = GetUrlParam('height');
    if (str === '0'){
		document.getElementById('header').style.display = 'none';
		document.getElementById('comments').style.display = 'none';
		document.getElementById('footer').style.display = 'none';
		document.getElementsByClassName('post-footer').item(0).style.display = 'none'
	}
	
    function GetUrlParam(paraName) {
        var url = document.location.toString();
        var arrObj = url.split("?");

        if (arrObj.length > 1) {
            var arrPara = arrObj[1].split("&");
            var arr;

            for (var i = 0; i < arrPara.length; i++) {
                 arr = arrPara[i].split("=");

                if (arr != null && arr[0] === paraName) {
                    return arr[1];
                }
            }
            return "";
        } else {
            return "";
        }
    }
</script>









  












  
  
    <script type="text/javascript" src="/limh/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/limh/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/limh/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/limh/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/limh/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/limh/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/limh/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/limh/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
